using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SlimeDieState : EnemyState
{
    Enemy_Slime enemy;
    public SlimeDieState(Enemy enemyBase, EnemyStateMachine enemyStateMachine, string animatorName, Enemy_Slime enemy) : base(enemyBase, enemyStateMachine, animatorName)
    {
        this.enemy = enemy;
    }

    public override void AnimatorFinishTrigger()
    {
        base.AnimatorFinishTrigger();
    }

    public override void Enter()
    {
        base.Enter(); 
        enemy.capsule.enabled = false;
        enemy.rigid.bodyType = RigidbodyType2D.Kinematic;
        stateTimer = 1f;
    }

    public override void Exit()
    {
        base.Exit();

    }

    public override void Update()
    {
        base.Update();
        rb.velocity = new Vector2(0, 0);
        if (stateTimer < 0)
        {
            enemy.rigid.bodyType = RigidbodyType2D.Dynamic;
            rb.velocity = new Vector2(0, -10);
        }
    }
}
